﻿using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;

using SBPweb.Modules.Modularity;
using SBPweb.Modules.Smartparts;

using SBPweb.MediaCenter.Common.Services;

namespace SBPweb.MediaCenter.Modules.Viewer.WPF
{

	public partial class ViewerMain : ISmartpart
    {
        #region Private fields

        private bool isModal;
        private Aligning align;
        private IModule parentModule;

        #endregion

        #region Constructor logic

        public ViewerMain(IModule module)
		{
            this.parentModule = module;
			this.InitializeComponent();
            ucToolBar.ParentModule = module;
            ucToolBar.SetEnabled(false);
        }

        #endregion
        
        #region ISmartpart Members

        public event EventHandler EnabledChanged;

        public event EventHandler VisibleChanged;

        public bool IsModal
        {
            get
            {
                return isModal;
            }
        }

        public IModule ParentModule
        {
            get
            {
                return parentModule;
            }
        }

        public new bool IsVisible
        {
            get
            {
                return base.IsVisible;
            }
            set
            {
                if (value)
                {
                    base.Visibility = Visibility.Visible;
                }
                else
                {
                    base.Visibility = Visibility.Hidden;
                }
            }
        }

        #endregion

        #region Methods

        public void Open(Uri uri)
        {
            iImage.Source = new BitmapImage(uri);
            ucToolBar.SetEnabled(null);
        }

        #endregion

    }

}